public class test5 {
    //面试题 17.16 按摩师
    public int massage(int[] nums) {
        //创建dp表
        //初始化
        //填表
        //返回值

        int n = nums.length;
        if(n==0) return 0;
        int[] dpf = new int[n];
        int[] dpg = new int[n];

        dpf[0] = nums[0];

        for(int i = 1;i<nums.length;i++){
            dpf[i] = dpg[i-1]+nums[i];
            dpg[i] = Math.max(dpf[i-1],dpg[i-1]);
        }
        return Math.max(dpf[n-1],dpg[n-1]);
    }
}
